let path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const htmlPlugin = require('html-webpack-plugin');

module.exports = {
	entry:{
		entry:'./src/index.js'
	},
	output:{
		path:path.resolve(__dirname,'dist'),
		filename:'bundle.js'
	},
	plugins:[
		new UglifyJsPlugin(),
		new htmlPlugin({
            minify:{
                removeAttributeQuotes:true
            },
            hash:true,
            template:'./src/index.html'
           
        })
	],
	module:{
        rules: [
            {
              test: /\.css$/,
              use: [ 'style-loader', 'css-loader' ]
            },
            {
               test:/\.(png|jpg|gif)/ ,
               use:[{
                   loader:'url-loader',
                   options:{
                       limit:500000
                   }
               }]
            }
          ]
    },
	devServer:{
		contentBase:path.resolve(__dirname,'dist'),
		host:'localhost',
        //服务端压缩是否开启
        compress:true,
        //配置服务端口号
        port:8080
	}
}